#region license
# This file is part of Grawlix.
# 
# Grawlix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# 
# Grawlix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with Grawlix.  If not, see
# <http://www.gnu.org/licenses/>.
#endregion

"""Loads and manages the current Game object."""

namespace Grawlix.Services
import System

interface IGameLoader:
"""Loads and manages the currently active game."""
	
	def LoadLocal()
	"""
	Starts loading the local game.
	Remarks: The local game is used to ask the player
		which server to connect to.
		
		It can also be used for testing purposes.
	"""
	
	def Host(worldName as string, port as int)
	"""
	Emulates a game locally for others to connect to.
	Param worldName: The name of world to host.
	Param port: The port on the host to connect to.
	"""
	
	def Connect(hostname as string, port as int)
	"""
	Starts loading a game over the network.
	Param hostname: The name of the host or IP address.
	Param port: The port on the host to connect to.
	"""
	
	def CancelLoad()
	"""
	Cancels the currently specified load.
	Does not quit or change the current game.
	"""
	
	def Quit()
	"""
	Starts the process of exiting the game.
	Remarks: This will force a complete game exit.
		To get back to the local game, call LoadLocal.
	"""
	
	def Update(elapsed as timespan) as Game
	"""
	Update the game loader.
	Param elapsed: The amount of time since last update.
	Returns: The currently loaded game.
	Remarks:
		For front-end use only.
		
		Will cause errors if not called by the front end, as
		it may invalidate a game that is already in use.
	"""
	
	Loading:
	"""An indicator describing whether a game is being loaded."""
		get
	
	HasQuit as bool:
	"""An indicator describing whether the game is shutting down."""
		get
	
